def merge_sort(seq=[]):
    if len(seq) == 1:
        return seq
    else:
        mid = len(seq)//2
        left = []
        right = []
        left_ = merge_sort(seq[:mid])
        right_= merge_sort(seq[mid:])

    return merge(left_,right_)

def merge(left_=[],right_=[]):
    i,j =0,0
    result_ = []
    while i < len(left_) and j < len(right_):

        if left_[i] <= right_[j]:
            result_.append(left_[i])
            i = i + 1
        else:
            result_.append(right_[j])
            j = j + 1
    result_ = result_ + left_[i:]
    result_ = result_ + right_[j:]
    return  result_


seq = [38,27,43,3,9,82,10]

result=merge_sort(seq)

print('result',result)